package com.triplelink.to.steak;

import com.triplelink.annotations.ClassType;

public class InstancePartTO
{
	private String id;
	private Object entity;
	private Class<?> classEntity;
	private boolean cascadeSave;
	
	public InstancePartTO(String id, Object entity, Class<?> classEntity, boolean cascadeSave) throws IllegalArgumentException, IllegalAccessException
	{
		this.id = id;
		this.entity = entity;
		this.classEntity = classEntity;
		this.cascadeSave = cascadeSave;
	}
	
	public InstancePartTO(Class<?> classEntity, InstancePartTO item) throws IllegalArgumentException, IllegalAccessException
	{
		this.id = item.getId();
		this.entity = item.getEntity();
		this.classEntity = classEntity;
		this.cascadeSave = item.isCascadeSave();
	}

	public Object getEntity() {
		return entity;
	}

	public void setEntity(Object entity) {
		this.entity = entity;
	}

	public ClassType getClassType() {
		return classEntity.getAnnotation(ClassType.class);
	}

	public Class<?> getClassEntity() {
		return classEntity;
	}

	public void setClassEntity(Class<?> classEntity) {
		this.classEntity = classEntity;
	}

	public boolean isCascadeSave() {
		return cascadeSave;
	}

	public void setCascadeSave(boolean cascadeSave) {
		this.cascadeSave = cascadeSave;
	}

	public String getId() {
		return id;
	}
}